package com.qaml.mes.device.enums;



import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;

/**
 * @ClassName OrderTypeEnum
 * @Description 任务单类型
 * @Author leikai
 * @Date 2023/10/25 16:51
 * @Version 1.0
 */
public enum OrderTypeEnum {
    MAINTAIN("MAINTAIN", "保养任务"),
    MAINTAIN_ERR("MAINTAIN_ERR", "保养异常处理任务"),
    INSPECTION("INSPECTION", "点检任务"),
    INSPECTION_ERR("INSPECTION_ERR", "点检异常处理任务"),
    RECHECK("RECHECK", "复核任务"),
    REPAIR("REPAIR", "维修任务"),
    ;

    private String type;

    private String desc;

    OrderTypeEnum(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public String getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public static OrderTypeEnum ofType(String type) {
        if (StringUtils.isBlank(type)) {
            return null;
        }
        return Arrays.stream(values()).filter(orderTypeEnum -> type.equals(orderTypeEnum.getType())).findFirst().orElse(null);
    }
}
